/*
 * @Description: 流程 - 接口
 * @Author: DHL
 * @Date: 2022-08-19 15:43:19
 * @LastEditors: DHL
 * @LastEditTime: 2023-07-28 09:40:16
 */

import { $get, $post } from '@/utils/http'
import { ContentTypeEnum } from '@/constant/http'
import { Result } from '@/model/baseModel'
import {
  FlowTaskListResultModel,
  FlowTaskPageParams,
  FlowTaskPageResultModel,
  FlowTaskParams
} from './model/flowTask'

/**
 * 查询待办任务
 * @param params
 * @returns
 */
export const apiFlowTaskTodo = (params: FlowTaskPageParams) =>
  $get<FlowTaskPageResultModel>({
    url: '/flowTask/searchTodo',
    params: params
  })

/**
 * 查询已办任务
 * @param params
 * @returns
 */
export const apiFlowTaskDone = (params: FlowTaskPageParams) =>
  $get<FlowTaskPageResultModel>({
    url: '/flowTask/searchDone',
    params: params
  })

/**
 * 查询节点表单配置
 * @param params
 * @returns
 */
export const apiFlowTaskFormKey = (params: FlowTaskParams) =>
  $get<Result<string>>({
    url: '/flowTask/searchFormKey',
    params: params
  })

/**
 * 同意
 * @param submitParams
 * @returns
 */
export const apiFlowTaskComplete = (submitParams: any) =>
  $post<Result<string>>({
    url: '/flowTask/complete',
    contentType: ContentTypeEnum.json,
    params: submitParams
  })

/**
 * 撤回
 * @param submitParams
 * @returns
 */
export const apiFlowTaskRevoke = (submitParams: any) =>
  $post<Result<string>>({
    url: '/flowTask/revoke',
    contentType: ContentTypeEnum.json,
    params: submitParams
  })

/**
 * 驳回
 * @param submitParams
 * @returns
 */
export const apiFlowTaskReject = (submitParams: any) =>
  $post<Result<string>>({
    url: '/flowTask/reject',
    contentType: ContentTypeEnum.json,
    params: submitParams
  })

/**
 * 转办
 * @param submitParams
 * @returns
 */
export const apiFlowTaskTurn = (submitParams: any) =>
  $post<Result<string>>({
    url: '/flowTask/turn',
    contentType: ContentTypeEnum.json,
    params: submitParams
  })

/**
 * 委派
 * @param submitParams
 * @returns
 */
export const apiFlowTaskDelegate = (submitParams: any) =>
  $post<Result<string>>({
    url: '/flowTask/delegate',
    contentType: ContentTypeEnum.json,
    params: submitParams
  })

/**
 * 查询可退回节点集合
 * @param params
 * @returns
 */
export const apiFlowTaskSearchBackList = (params: FlowTaskParams) =>
  $get<FlowTaskListResultModel>({
    url: '/flowTask/searchBackList',
    params: params
  })

/**
 * 退回
 * @param submitParams
 * @returns
 */
export const apiFlowTaskBack = (submitParams: any) =>
  $post<Result<string>>({
    url: '/flowTask/back',
    contentType: ContentTypeEnum.json,
    params: submitParams
  })
